<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="bill" />
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <h:outputStylesheet library="css" name="pharmacyA4.css"/>
        <div class="posbill noBorder summeryBorder">

            <div class="institutionName">
                <h:outputLabel value="#{cc.attrs.bill.department.printingName}"/>
            </div>
            <div class="institutionContact" >
                <div>
                    <h:outputLabel value="#{cc.attrs.bill.department.address}"/>
                </div>
                <div >
                    <!--                    <h:outputLabel value="Tel : 0912234059 - 60 , "/>-->
                    <h:outputLabel value="#{cc.attrs.bill.department.telephone1} "/>
                    <h:outputLabel value="#{cc.attrs.bill.department.telephone2}"/>
                </div>
                <div >
                    <!--<h:outputLabel value="Fax : 0912234061 "/>-->
                    <h:outputLabel value="#{cc.attrs.bill.department.fax}"/>                                                 
                </div>
                <div >
                    <!--<h:outputLabel value="Email : ruhunuhos@sltnet.lk "/>-->
                    <h:outputLabel value="#{cc.attrs.bill.department.email}"/>                                                 
                </div>
            </div>

            <div class="headingBill">
                <h:outputLabel value="Good Recieve Note(Cancel)" style="text-decoration: underline;"/>                           
            </div>

            <h:panelGrid columns="4" style="min-width: 100%;">




                <h:outputLabel value="G.R.N. Cancel No"/>
                <h:outputLabel value="#{cc.attrs.bill.deptId}" />

                <h:outputLabel value="G.R.N.No "/>
                <h:outputLabel value="#{cc.attrs.bill.billedBill.deptId}"/>

                <h:outputLabel value="Cancel Date  " />
                <h:outputLabel value="#{cc.attrs.bill.createdAt}">
                    <f:convertDateTime pattern="dd MM yyyy"/>
                </h:outputLabel>

                <h:outputLabel value="G.R.N.Date  "/>
                <h:outputLabel value="#{cc.attrs.bill.billedBill.createdAt}">
                    <f:convertDateTime pattern="dd MM yyyy"/>
                </h:outputLabel >

                <h:outputLabel value="Cancel Time  " />
                <h:outputLabel value="#{cc.attrs.bill.createdAt}" >
                    <f:convertDateTime pattern="hh mm a"/>
                </h:outputLabel>

                <h:outputLabel value="G.R.N.Time  "/>
                <h:outputLabel value="#{cc.attrs.bill.billedBill.createdAt}">
                    <f:convertDateTime pattern="hh mm a"/>
                </h:outputLabel>

                <h:outputLabel value="Cancelled By "/>
                <h:outputLabel value="#{cc.attrs.bill.creater.webUserPerson.name}" />
                <h:outputLabel value="Invoice No "/>
                <h:outputLabel value="#{cc.attrs.bill.invoiceNumber}"/>

                <h:outputLabel value="Location "/>
                <h:outputLabel value="#{cc.attrs.bill.department.name}" />
                <h:outputLabel value="Supplier "/>
                <h:outputLabel value="#{cc.attrs.bill.fromInstitution.name}"/>

            </h:panelGrid>


            <div >
                <p:spacer height="15px"/>
                <p:dataTable rowIndexVar="rowIndex" styleClass="noBorder normalFont" value="#{cc.attrs.bill.billItems}" var="bip" style=" text-align: center;">                                     
                    <p:column style="text-align: left!important;"  >
                        <f:facet name="header">
                            <h:outputLabel value="Item" style="font-weight: bold!important; " />
                        </f:facet>
                        <h:outputLabel value="#{bip.item.name}"/>
                    </p:column>
                    <p:column style="width: 8px;text-align: right!important;" >
                        <f:facet name="header">
                            <h:outputLabel value="Expiry" style="font-weight: bold!important;" />
                        </f:facet>
                        <h:outputLabel value="#{bip.pharmaceuticalBillItem.doe}">
                            <f:convertDateTime pattern="dd/MM/yy"/>
                        </h:outputLabel>
                    </p:column>                                  
                    <p:column style="text-align: right!important;">
                        <f:facet name="header">
                            <h:outputLabel value="Ord" style="font-weight: bold!important;" />
                            <br/>
                            <h:outputLabel value="QTY" style="font-weight: bold!important;" />
                        </f:facet>
                        <h:outputLabel value="#{bip.referanceBillItem.pharmaceuticalBillItem.qty}">
                            <f:convertNumber integerOnly="true"/>
                        </h:outputLabel>
                    </p:column>
                    <p:column style="text-align: right!important;"> 
                        <f:facet name="header">
                            <h:outputLabel value="Rcv" style="font-weight: bold!important;" />
                            <br/>
                            <h:outputLabel value="QTY" style="font-weight: bold!important;" />
                        </f:facet>
                        <h:outputLabel value="#{bip.pharmaceuticalBillItem.qty}">
                            <f:convertNumber integerOnly="true"/>
                        </h:outputLabel>
                    </p:column>                  
                    <p:column style="text-align: right!important;">
                        <f:facet name="header">
                            <h:outputLabel value="Fr" style="font-weight: bold!important;" />
                            <br/>
                            <h:outputLabel value="QTY" style="font-weight: bold!important;" >

                            </h:outputLabel>
                        </f:facet>
                        <h:outputLabel value="#{bip.pharmaceuticalBillItem.freeQty}"/>
                    </p:column>
                    <p:column style="text-align: right!important;">
                        <f:facet name="header">
                            <h:outputLabel value="Cur" style="font-weight: bold!important;" />
                            <br/>
                            <h:outputLabel value="Price" style="font-weight: bold!important;" />
                        </f:facet>
                        <h:outputLabel value="#{bip.pharmaceuticalBillItem.purchaseRate}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>
                    </p:column>
                    <p:column style="text-align: right!important;">
                        <f:facet name="header">
                            <h:outputLabel value="Last" style="font-weight: bold!important;" />
                            <br/>
                            <h:outputLabel value="Price" style="font-weight: bold!important;" />
                        </f:facet>
                        <h:outputLabel value="#{bip.pharmaceuticalBillItem.lastPurchaseRate}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </p:column>
                    <p:column style="text-align: right!important;">
                        <f:facet name="header">
                            <h:outputLabel value="Amount" style="font-weight: bold!important;" />
                            <br/>
                            <h:outputLabel value=" " style="font-weight: bold!important;" />
                        </f:facet>
                        <h:outputLabel value="#{bip.pharmaceuticalBillItem.purchaseRate*bip.pharmaceuticalBillItem.qty}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </p:column>
                    <p:column style="text-align: right!important;">
                        <f:facet name="header">
                            <h:outputLabel value="Sale" style="font-weight: bold!important;" />
                            <br/>
                            <h:outputLabel value="Price" style="font-weight: bold!important;" />
                        </f:facet>
                        <h:outputLabel value="#{bip.pharmaceuticalBillItem.retailRate}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </p:column>

                    <p:columnGroup type="footer">

                        <p:row>
                            <p:column colspan="7" footerText="Total" style="font-weight: bold!important;"/>
                            <p:column style="text-align: right;" footerText="#{0-cc.attrs.bill.total}">
                                <f:facet name="footer">
                                    <br></br>
                                    <h:outputLabel value="#{0-cc.attrs.bill.total}">
                                        <f:convertNumber pattern="#,##0.00" />
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column />
                        </p:row>

                        <p:row>
                            <p:column colspan="7" footerText="Expenses" style="font-weight: bold!important;"/>
                            <p:column style="text-align: right;" footerText="#{0-cc.attrs.bill.total}">
                                <f:facet name="footer">
                                    <br></br>
                                    <h:outputLabel value="#{0-cc.attrs.bill.expenseTotal}">
                                        <f:convertNumber pattern="#,##0.00" />
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column />
                        </p:row>

                        <p:row >
                            <p:column colspan="7" footerText="Tax"/>
                            <p:column style="text-align: right;" footerText="#{cc.attrs.bill.tax}">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{cc.attrs.bill.tax}">
                                        <f:convertNumber pattern="#,##0.00" />
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column />
                        </p:row>
                        <p:row >
                            <p:column colspan="7" footerText="Discount"/>
                            <p:column style="text-align: right;" footerText="#{0-cc.attrs.bill.discount}">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{0-cc.attrs.bill.discount}" style="text-decoration: underline;">
                                        <f:convertNumber pattern="#,##0.00" />
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column />
                        </p:row>
                        <p:row >
                            <p:column colspan="7" footerText="Net Total" style="font-weight: bold!important;"/>
                            <p:column style="text-align: right;" footerText="#{cc.attrs.bill.netTotal}">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{0-cc.attrs.bill.netTotal}" style="font-weight: bold!important; text-decoration: underline;">
                                        <f:convertNumber pattern="#,##0.00" />
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column />
                        </p:row>
                    </p:columnGroup>
                </p:dataTable>
            </div>

            <div>
                <p:dataTable id="tblExpenses" value="#{cc.attrs.bill.billExpenses}" var="be"
                             emptyMessage="No Bill Expenses" >
                    <p:column headerText="Expense" >
                        <h:outputLabel value="#{be.item.name}" ></h:outputLabel>
                    </p:column>
                    <p:column headerText="Value" >
                        <h:outputLabel value="#{be.netValue}" >
                            <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                        </h:outputLabel>
                    </p:column>
                    <p:column headerText="Descreption" >
                        <h:outputLabel value="#{be.descreption}" ></h:outputLabel>
                    </p:column>
                </p:dataTable>
            </div>

            <div class="preparedBy">
                <h:outputLabel value="Prepared By : #{cc.attrs.bill.creater.webUserPerson.nameWithTitle}" style="text-align: right!important;"/>

            </div>

            <div >
                <h:outputLabel value="Received By : " style="text-align: right!important;"/>
            </div>

            <hr/>
<!--            <div >

                <h4 style="color: #000000; text-align: center " >
                    <h:outputLabel value="Payment Voucher" style="text-decoration: underline;"/>
                </h4>


                <div>
                    <h:outputLabel value="Date :"  style="position: relative; left: 70%;" />
                    <h:outputLabel value="Payee : " style="text-align: right!important;"/>
                    <h:outputLabel value="#{cc.attrs.bill.fromInstitution.name}"/>
                </div>
                <div>
                    <br></br>
                    <h:outputLabel value="Prepared By :" /> 
                    <h:outputLabel value="................................................................."/>
                    <br></br>                
                    <br></br>         
                    <h:outputLabel value="Approved By :"/>
                    <h:outputLabel value="................................................................."/>
                    <br></br>                                      
                    <br></br>
                    <h:outputLabel value="Authorized By :"/>
                    <h:outputLabel value="................................................................"/>
                    <br></br>
                    <br></br>

                    <h:outputLabel value="Cheque No :"/>
                    <h:outputLabel value="...................................................................."/>
                    <h:outputLabel value="Amount : Rs. ................" style="position: absolute; left: 70%;"/>
                    <br></br>
                    <br></br>                    
                    <h:outputLabel value="Received with thanks sum of Rupees  .................................................................................................................................................. #{cc.attrs.bill.creater.institution.name} &nbsp; : "/>
                    <br></br>

                                        <div >

                    <h:outputLabel value="Date :"  style="position: relative; left: 70%;" />
                                            <br/>
                                            <h:outputLabel value="Amount : Rs. " style="font-weight: bold;position: relative; left: 70%;"/>
                                            <h:outputLabel value="#{0-cc.attrs.bill.netTotal}" style="font-weight: bold;position: relative; left: 71%;">
                    <f:convertNumber pattern="#,##0.00" />
                                            </h:outputLabel>
                                            <br/>
                    <div>
                        <h:outputLabel value="Stamp : " style="position: relative; left: 70%; "/>
                        <div style="position: relative; border: 1px black dashed!important;height: 60px;width: 50px; left: 75%;">
                        </div>
                                                <h:outputLabel value="Stamp " style="position: relative; left: 70%;"/>
                                                <br></br>
                        <h:outputLabel value="Date : " style="position: relative; left: 70%;"/>
                        <br></br>
                        <h:outputLabel value="Name : " style="position: relative; left: 70%;"/>
                    </div>
                </div>

            </div>-->
        </div>
    </cc:implementation>
</html>
